@extends('default.mobile.layouts.indexPublic')
@section('title'){{ $jobinfo->job_title.'招聘'.(empty($jobinfo->recruiting_num)?'若干':$jobinfo->recruiting_num).'名_'.$jobinfo->company_basic->company_name.'_'.Site::get('webname') }} @endsection

{{--首页css--}}
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/mobile/index/common.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/mobile/index/job_info.css')}}">
    @endsection
    {{--头部标签--}}
    @section('tag','职位详情')
    {{--主体内容--}}
    @section('content')
            <!-- B 职位详情 -->
    <div class="job_info">
        <div class="base_info">
            <div class="job_name">
                <span class="job_title">{{ str_limit($jobinfo->job_title,14) }}</span>
                @if(!empty($jobinfo->part_status) && $jobinfo->part_status == '2')
                    <em class="one"></em>
                @elseif(!empty($jobinfo->part_status) && $jobinfo->part_status == '3')
                    <em class="two"></em>
                @elseif(!empty($jobinfo->part_status) && $jobinfo->part_status == '4')
                    <em class="three"></em>
                @endif
                <i class="money">{{ $jobinfo->salary_above }}</i></div>
            <ul class="item">
                @if(!empty($jobinfo->location))
                    <li><i class="baseinfo01"></i>{{ str_limit($jobinfo->location,22) }}</li>@endif
                @if(!empty($jobinfo->education))
                    <li><i class="baseinfo03"></i>{{ $jobinfo->education }}</li>@endif
                @if(!empty($jobinfo->work_year))
                    <li><i class="baseinfo04"></i>{{ $jobinfo->work_year }}</li>@endif
            </ul>
            <div class="job_fit_tags">
                <ul>
                    @if(count($jobinfo->welfare) > 0 && !empty($jobinfo->welfare))
                        @foreach($jobinfo->welfare as $v)
                            <li>{{ $v }}</li>
                        @endforeach
                    @endif
                </ul>
                <div class="more_fit more_tags"></div>
            </div>
        </div>
        <div class="company_info">
            <a href="{{url('mobile/comabout_'.idEncryption($jobinfo->com_id).'.html')}}" class="clear">
                <img src="{{asset( $jobinfo->company_basic->logo )}}" alt="">
                <div class="company_name">{{ str_limit($jobinfo->company_basic->company_name,30) }}</div>
                <p>{{ str_limit($jobinfo->industry,32) }}</p>
                <i class="ic_arow"></i>
            </a>
        </div>
    </div>
    <!-- E 职位详情 -->

    <!-- B 职位描述 -->
    <div class="info">
        <div class="title">
            <i class="icon_description"></i>
            <h2>职位描述</h2>
        </div>
        <div class="content">
            <div class=introduction>
                <p>{!! nl2br(e($jobinfo->description)) !!}<p>
            </div>
        </div>
    </div>
    <!-- E 职位描述 -->

    <!-- B 工作地址 -->
    <div class="info">
        <div class="title">
            <i class="icon_address"></i>
            <h2>地址</h2>
        </div>
        <div class="content">
            <div class="address">
				<span class="arrow">
					@if(!empty($companyBasic->longitude) && !empty($companyBasic->latitude))
                        <a href="{{url('mobile/setmap_'.idEncryption($companyBasic->id).'.html')}}">
                            {{ str_limit($jobinfo->company_basic->address,50) }}<i class="ic_arow"></i></a>
                    @else
                        <a onclick="javascript:layerMsg('您还未设置地图坐标！',2)">
                            {{ str_limit($jobinfo->company_basic->address,50) }}<i class="ic_arow"></i></a>
                    @endif
				</span>
            </div>
        </div>
    </div>
    <!-- E 工作地址 -->


    <!-- B 工作地址 -->
    <div class="info" style=" margin-bottom:1.3rem;">
        <div class="title">
            <i class="icon_publisher"></i>
            <h2>发布人</h2>
            @if(!Auth::guard('personal')->check() && Site::get('viewContact') =='2')
                <span class="look">
                <a class="viewContact" id="viewContact">[查看联系方式]</a>
            </span>
            @endif
        </div>
        <div class="content">
            <div class="publisher">
                <span><img src="{{asset( $jobinfo->company_basic->logo )}}" alt=""></span>
                <dl>
                    <dt>{{ $jobinfo->contacts }}</dt>
                    @if(!Auth::guard('personal')->check() && Site::get('viewContact') =='2')
                        <dd>
                            @if(!empty($jobinfo->strmobile))<span class="two">{{ $jobinfo->strmobile }}</span>@endif
                            @if(!empty($jobinfo->strphone))<span>{{ $jobinfo->strphone }}</span>@endif
                        </dd>
                    @else
                    <dd>
                        @if(Site::get('member_contact')==2 && $companyUser->viptime<date('Y-m-d H:i:s'))
                            <span class="two">该企业只支持简历投递，暂不公开联系方式</span>
                        @else
                        @if(!empty($jobinfo->mobile))<span class="two">{{ $jobinfo->mobile }}</span>@endif
                        @if(!empty($jobinfo->phone))<span>{{ $jobinfo->phone }}</span>@endif
                        @endif
                    </dd>
                    @endif
                </dl>
            </div>
        </div>
    </div>
    <!-- E 工作地址 -->

    <!-- B 操作按钮 -->
    @if( !empty(Site::get('appPersonHasIOS')) || !empty(Site::get('appPersonHasAndroid') ) )
    <div class="operation">
        <div class="wrap">
            <span class="chat"><a href="{{url('app_code')}}">聊一聊</a> </span>
            <span class="delivery"><a class="{{ $applyJobButton }}">{{ $applyString }}</a></span>
            <span class="phone"><a @if(auth()->guard('personal')->check()) href="tel:{{ $jobinfo->dial }}"
                                   @endif class="tel"></a></span>
        </div>
    </div>
    @else
    <div class="operation">
        <div class="wrap">
            <a @if(auth()->guard('personal')->check()) href="tel:{{ $jobinfo->dial }}" @endif class="tel"><img
                        src="{{asset('default/images/mobile/layout/tel.png')}}" alt=""></a>
            <a class="send {{ $applyJobButton }}">{{ $applyString }}</a>
        </div>
    </div>
    @endif
    <!-- E 操作按钮 -->

@endsection
@section('footerjs')
    @parent
    <script type="text/javascript">
        //跳转登录页面
        $(function(){
            $(".personlogin").click(function(){
                layer.open({
                    content: '登录后才能申请职位，现在登录吗？'
                    , btn: ['登录', '稍等一会']
                    , yes: function(index){
                        window.location.href = "{{ url("mobile/personal/login") }}";
                    }
                });
            });
        });
        //登录后才能拨号
        @if(!auth()->guard('personal')->check())
            $(".tel").click(function(){
            layer.open({
                    content: '登录后才能拨号，现在登录吗？'
                    , btn: ['登录', '稍等一会']
                    , yes: function(index){
                        window.location.href = "{{ url("mobile/personal/login") }}";
                    }
                });
            });
        @endif
        @if(!Auth::guard('personal')->check() && Site::get('viewContact') =='2')
            $(".viewContact").click(function(){
                layer.open({
                    content: '登录后才能查看联系方式，现在登录吗？'
                    , btn: ['登录', '稍等一会']
                    , yes: function(index){
                        window.location.href = "{{ url("mobile/personal/login") }}";
                    }
                });
            });
        @endif
        //申请职位
        $(".applyjob").click(function(){
            $.ajax({
                url: "{{ url("personal/applyjob") }}",
                dataType: "json",
                data: "jobid={{$jobid}}",
                type: "GET",
                time: 0,
                success: function(data){
                    switch(data.status){
                        case 0:
                            layerMsg(data.msg, 2);
                            return true;
                            break;
                        case 1:
                            layerMsg(data.msg, 2);
                            break;
                        case 2:
                            layerMsg(data.msg, 2);
                            location.href = "{{ url("mobile/personal/my_resume") }}";
                            break;
                        default:
                            layerMsg(data.msg, 2);
                            break;
                    }
                },
                error: function(data){
                    var msgErr = '';
                    var errors = $.parseJSON(data.responseText);
                    $.each(errors, function(index, value){
                        msgErr += value + ";<br>";
                    });
                    layerMsg(msgErr, 2);
                },
                complete: function(){
                }
            });
            return false;
        });
    </script>
@endsection